/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
/**
 * 操作权限处理
 * Copyright (c) 2019 fat
 */

import usePermission from '@/hooks/usePermission'
import { ObjectDirective } from 'vue'

const auth = usePermission()
export const hasPermi: ObjectDirective = {
  mounted(el: HTMLElement, binding: any) {
    const { value } = binding
    if (auth.checkPermission(value) === false) {
      el.parentNode && el.parentNode.removeChild(el)
    }
  },
}
